package com.kbbywyclient.app;

import com.kbbywyclient.BuildConfig;
import com.kbbywyclient.util.pre.PreUtils;

/**
 * Created by FHW
 * on 2017/3/21
 */

public class API {
    public static final String PAY_ADDRESS = "http://pay.cardbaobao.com/";//充值服务器地址
    public static final String PIC_ADDRESS;
    public static final String SERVER_ADDRESS;
    public static final String WEB_ADDRESS;

    //开发环境
    private static final String[] DEBUG_ADDRESS={
            "https://img.cardbaobao.com",//图片地址
            "https://api.cardbaobao.com/",//接口地址
            "https://m.cardbaobao.com/"//h5页面地址
    };

    //测试环境一
    private static final String[] BETA_1_ADDRESS={
            "http://192.168.1.78:8090",//图片
            "http://192.168.1.21:8091/",//接口
            "http://192.168.1.21:8082/"//h5页面地址
    };

    //测试环境二
    private static final String[] BETA_2_ADDRESS={
            "http://192.168.1.78:8080",//图片
            "http://192.168.1.22:8091/",//接口地址
            "http://192.168.1.22:8082/"//h5页面地址
    };

    //灰度环境
    private static final String[] GRAY_ADDRESS={
            "http://img.cardbaobao.com",//图片
            "http://api1.cardbaobao.com/",//接口
            "http://mgray.cardbaobao.com/"//h5页面地址
    };

    //生产环境
    private static final String[] PRODUCT_ADDRESS={
            "https://img.cardbaobao.com",//图片地址
            "https://api.cardbaobao.com/",//接口地址
            "https://m.cardbaobao.com/"//h5页面地址
    };

    static {
        String[] address;
        if (Constants.PRODUCT_ENVIRONMENT.equals(BuildConfig.BUILD_TYPE)) {
            //生产环境
            address = PRODUCT_ADDRESS;
        } else {
            switch (PreUtils.getApiAddressType(AppHelper.getApplicationContext())) {
                case 1:
                    address = BETA_1_ADDRESS;
                    break;
                case 2:
                    address = BETA_2_ADDRESS;
                    break;
                case 3:
                    address = GRAY_ADDRESS;
                    break;
                case 4:
                    address =PRODUCT_ADDRESS;
                    break;
                default:
                    address = DEBUG_ADDRESS;
                    break;
            }
        }
        PIC_ADDRESS=address[0];
        SERVER_ADDRESS=address[1];
        WEB_ADDRESS=address[2];
    }

    public static final String APPType = "1"; //0为IOS,1安卓

    public static final String PAGE_SIZE = "10"; //默认1页显示10条

    //////////////////////////////////////////////////////////////////////////////////////////////////

    public static final String PIC_CODE = API.SERVER_ADDRESS + "images/pic/makePicCode.do";//图片验证码

    public static final String ABOUT_PROVI = API.WEB_ADDRESS + "commonApp/aboutProvi.do";//注册协议

    public static final String CREDIT_DETAIL = API.WEB_ADDRESS + "kbb/creditFormDetail.do";//信用卡 详情

    public static final String LOANS_DETAIL = API.WEB_ADDRESS + "kbb/loansFormDetail.do";//贷款 详情

    public static final String MATCH_TABLE = API.WEB_ADDRESS + "html/pop1.html";//匹配

    public static final String PRODUCT_TABLE = API.WEB_ADDRESS + "html/pop2.html";//产品

    public static final String BOUGHT_TABLE = API.WEB_ADDRESS + "html/pop4.html";//已购买

    public static final String CUSTOMER_TABLE = API.WEB_ADDRESS + "html/pop3.html";//客户

    public static final String ACTIVITY_TABLE = API.SERVER_ADDRESS + "salesSetting.do";//活动

    public static final String STORE_SETTING = API.WEB_ADDRESS + "kbb/salesLoansShop.do";//店铺设置

    public static final String SCORE_EARN = API.WEB_ADDRESS + "kbb/scoreType.do";//积分赚取

    public static final String SHARE_URL = API.WEB_ADDRESS + "about/about!cardbb.do";//分享下载地址

    public static final String ADD_PRODUCT = API.WEB_ADDRESS + "kbb/saveProductLoans.do";//添加产品

    public static final String ABOUT_ME = API.WEB_ADDRESS + "commonApp/aboutHtml.do";//关于我们

    //////////////////////////////////////////////////////////////////////////////////////////////////
    public static final String BIG_DATA_BURIED_URL = PIC_ADDRESS + "ambushLogger/writeLog.do";
}
